﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using Jxym.DBUtility;
using Jxym.wlkc2011.Module.Default.model;

namespace Jxym.wlkc2011.Module.Default.SERVER.role
{
    public partial class RoleDel : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string returnVaoue = "";

            int count = 0;

            if (!IsPostBack)
            {
                if (Request.Params["roleid"] != null)
                {
                    string id = Request.Params["roleid"];

                    MsSqlDal<User_Role> iUr = new MsSqlDal<User_Role>();

                    try
                    {
                        count += iUr.Delete(id);
                        returnVaoue = "删除完成";
                    }
                    catch (Exception)
                    {
                        returnVaoue += "此角色已有用户使用或已分配权限，不能删除.";
                    }
                }
            }

            Response.Write("{'success':true,'count':" + count + ",'msg':'" + returnVaoue + "'}");
        }
    }
}